package com.tyj.movie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tyj.movie.entity.MovieArea;
import com.tyj.movie.entity.MovieType;
import com.tyj.movie.mapper.MovieTypeMapper;
import com.tyj.movie.service.MovieTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tyj
 * @since 2021-06-28
 */
@Service
public class MovieTypeServiceImpl extends ServiceImpl<MovieTypeMapper, MovieType> implements MovieTypeService {

    @Autowired
    MovieTypeMapper movieTypeMapper;

    @Override
    @Cacheable(value = "movie",key = "'type'",sync = true)
    public List<MovieType> getMovieTypes() {
        List<MovieType> typeList = movieTypeMapper.selectList(new QueryWrapper<MovieType>().orderByAsc("sort"));
        return typeList;
    }
}
